package HuaWeiOd.AA;

import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

/**
 * @author caihe
 * @date 2023/4/13 10:38
 */
public class 最短木板长度 {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        Queue<Integer> queue = new PriorityQueue<>();
        while(--n >= 0) {
            queue.add(sc.nextInt());
        }
        while(--m >= 0) {
            Integer poll = queue.poll();
            queue.add(poll + 1);
        }

        System.out.println(queue.poll());
    }
    
}
/*
5 3
4 5 3 5 5

5 2
4 5 3 5 5
 */